<template>
  <j-modal title="详情" :visible="visible" :footer="null" ok-text="" :fullscreen="true" :destroyOnClose="true" @close="()=>{visible = false,active='yearPlan'}">
    <div style="width: 100%">
      <a-tabs @change="handleTabChange">
        <a-tab-pane v-for="item in tabList" :key="item.key" :tab="item.title" :disabled="item.disable">
          <div class="">
            <component v-if="active == item.key" ref="tableModel" :planId="planId" :is="item.importSrc"></component>
          </div>
        </a-tab-pane>
      </a-tabs>
    </div>
  </j-modal>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { httpAction, getAction, postAction, deleteAction } from '@/api/manage'
import { columns1, columns2, columns3, columns4, columns5, columns6 } from './indexColumns'

export default {
  name: 'detailModel',
  mixins: [],
  components: {},
  data() {
    return {
      visible: false,
      active: 'yearPlan',
      tabList: [
        {
          key: 'yearPlan',
          title: '年度计划附件',
          importSrc: () => import('./components/yearPlanFile.vue'),
        },
        {
          key: ' executePlan',
          title: '实施计划',
          importSrc: () => import('./components/ssjh.vue'),
        },
        {
          key: 'examine',
          title: '穿行测试',
          disable:true,
          importSrc: () => import('./components/cxcs.vue'),
        },
        {
          key: '2',
          title: '跟踪整改汇总',
          importSrc: () => import('./components/zghz.vue'),
        },
        {
          key: '3',
          title: '缺陷统计表',
          importSrc: () => import('./components/qxtj.vue'),
        },
        {
          key: 'draft',
          title: '底稿附件',
          importSrc: () => import('./components/dgfj.vue'),
        },
        {
          key: 'sum',
          title: '汇总附件',
          importSrc: () => import('./components/hzfj.vue'),
        },
      ],
      // 表头
      columns1: columns1(this),
      columns2: columns2(this),
      columns3: columns3(this),
      columns4: columns4(this),
      columns5: columns5(this),
      columns6: columns6(this),
      url: {
        // list: '/sjzyzhgl/sjAuditOrg/list'
        list: '/incon/inconReviewPlan/queryFileList',
      },
      dataSource: [],
      planId: '',
    }
  },
  computed: {},
  mounted() {},
  // watch: {
  //   rowData: {
  //     handler(val) {
  //       debugger
  //       this.planId = val.id
  //     },
  //     deep: true,
  //   },
  // },
  methods: {
    getPlanId(row) {
      this.planId = row.id
    },
    async getYearPalnFile(id) {
      const data = await getAction(`${this.url.list}?planId=${id}&fileType=yearPlan`)
      if (data.code == 200) {
        this.dataSource = data.result.records
      }
    },
    // async getPlanFile()
    handleDownloadFile(fileUrl) {
      this.$message.success('正在下载，请稍等！')
      let url = `${window._CONFIG['domianURL']}/sys/common/download/${fileUrl}`
      window.open(url, '_blank')
    },
    handleTabChange(key) {
      console.log(key, 'key')
      this.active = key
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>